import random
import string
def solution(str):
        if(str[0]>='0'and str[0]<='9'):
            count,k,=0,0
            for i in range(1,len(str)):
                if(str[i]=='.'):
                    k=i
                    break
            for i in range(1,len(str)):
                if(i!=k and(str[i]<'0'or str[i]>'9')):
                    print('输入数字格式错误！')
                    return  False
            return  True
        elif(str[0]=='-'):
            if(str[1]<'0' or str[1]>'9'):
                print('输入数字格式错误！')
                return False
            else:
                count,k=0,0
                for i in range(2, len(str)):
                    if (str[i] == '.'):
                        k = i
                        break
                for i in range(1, len(str)):
                    if (i != k and (str[i] < '0' or str[i] > '9')):
                        print('输入数字格式错误！')
                        return False
                return True
        else:
            return False
def match():
    ##这里我以随机生成整数为例，随机生成浮点数同理
    ini_tialtotal=5000
    while(ini_tialtotal>0):
        s=input("请输入一个数：")
        if(solution(s)==True):
            a=random.randint(3,7)
            b=str(a)
            print(b)
            if(b==s):
                print('TRUE')
                c=input('答案正确，请问是否进行下一轮游戏？\n请输入yes/no')
                if(c=='yes'):
                    continue
                elif(c=='no'):
                    break
                ini_tialtotal+=3000
            else:
                print('False')
                ini_tialtotal-=500
    print('您的本金不足，游戏退出！')

match()




